// h5接口
// const h5wechatlogin = (params = {},url='/index/h5wechatlogin') => addActid(params,url);
// const getsign = (params = {},url='/index/getsign') => addActid(params,url);
// const base = (params = {},url='/index/base') => addActid(params,url);
// const getuserinfo = (params = {},url='/index/getuserinfo') => addActid(params,url);
// 新接口
const get = (url='/index/index',params = {}) => new_addActid(url,params);


// 小程序接口
// const getphone = (params = {},url='/index/getphone') => addActid(params,url);
// const miniapplogin = (params = {},url='/index/miniapplogin') => addActid(params,url);


function new_addActid(url='',params={}){
	// #ifdef H5
	  const urlcode=uni.$u.wx.getUrlCode();
	  params=Object.assign({}, urlcode, params);
		console.log(params,'请求参数整合')
	// #endif
	
	let res=uni.$u.get(url, params).catch(res=>{
		console.log('请求错误',res)
		if(!res.msg){
			uni.$u.route('pages/404/404');
		}
		return false;
	})
	return res;
}

function addActid(params={},url=''){
	// #ifdef H5
	  const urlcode=uni.$u.wx.getUrlCode();
	  params=Object.assign({}, urlcode, params);
	  console.log(params,'请求参数整合')
	// #endif
	
	let res=uni.$u.get(url, params).catch(res=>{
		console.log('请求错误',res)
		if(!res.msg){
			uni.$u.route('pages/404/404');
		}
		return false;
	})
	return res;
}
export default {
	get
}
